﻿<ui:DialogWindow x:Name="Window"
                 x:Class="CodeStash.Addin.Views.AddSnippetView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:enum="clr-namespace:CodeStash.Common.Enums;assembly=CodeStash.Common"
                 xmlns:extension="clr-namespace:CodeStash.Addin.Extensions"
                 xmlns:local="clr-namespace:CodeStash.Addin"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
                 xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:core="clr-namespace:CodeStash.Addin.Core;assembly=CodeStash.Addin.Core"
                 xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                 SizeToContent="Height"
                 Width="500"
                 Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}"
                 Foreground="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowTextKey}}"
                 ShowInTaskbar="False"
                 Title="Save Snippet"
                 WindowStartupLocation="CenterScreen"
                 mc:Ignorable="d" Height="501.874">
    <ui:DialogWindow.Resources>
        
        
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment"
                    Value="Left" />
            <Setter Property="VerticalAlignment"
                    Value="Bottom" />
        </Style>

        <ImageSource PresentationOptions:Freeze="true"
                     x:Key="logoImage">/CodeStash.Addin;component/Images/Logo.png</ImageSource>


    </ui:DialogWindow.Resources>

    <Grid x:Name="LayoutRoot">

        <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="25.133" />
                <RowDefinition Height="31.2" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25" />
                <RowDefinition Height="58" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="60" />
                <RowDefinition Height="25.133" />
                <RowDefinition Height="25.133" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <ComboBox Width="304"
                      Grid.Row="13"
                      HorizontalAlignment="Left"
                      Margin="6,0,10,0"
                      VerticalAlignment="Center"
                      ItemsSource="{Binding Source={extension:Enum {x:Type enum:CodeSnippetVisibility}}}"
                      SelectedItem="{Binding SnippetVisibility, Mode=TwoWay}"
                      SelectedIndex="0" />
            <TextBlock Grid.Row="0"
                       Text="Language"
                       TextWrapping="Wrap" />
            <ComboBox Grid.Row="1"
                      VerticalAlignment="Center"
                      DisplayMemberPath="Language"
                      ItemsSource="{Binding Languages}"
                      core:ControlValidation.ErrorProperty="SelectedLanguage"
                      core:ControlValidation.ValidationSource="{Binding Validator}"
                      Validation.ErrorTemplate="{x:Static core:ControlValidation.ErrorTemplate}"
                      SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}" />
            <TextBlock Grid.Row="2"
                       Text="Title"
                       TextWrapping="Wrap" />
            <TextBox Grid.Row="3"
                     VerticalAlignment="Center"
                     core:ControlValidation.ErrorProperty="Title"
                     core:ControlValidation.ValidationSource="{Binding Validator}"
                     Validation.ErrorTemplate="{x:Static core:ControlValidation.ErrorTemplate}"
                     Text="{Binding Title, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                     TextWrapping="Wrap" MaxLength="50" />
            <TextBlock Grid.Row="4"
                       Text="Description"
                       TextWrapping="Wrap" />
            <TextBox Grid.Row="5"
                     VerticalAlignment="Top"
                     core:ControlValidation.ErrorProperty="Description"
                     core:ControlValidation.ValidationSource="{Binding Validator}"
                     Validation.ErrorTemplate="{x:Static core:ControlValidation.ErrorTemplate}"
                     Text="{Binding Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                     TextWrapping="Wrap" AcceptsReturn="True" Height="58" MaxLength="200" />
            <TextBlock Grid.Row="6"
                       Text="Tags (separate each tag with a &quot;,&quot; character)"
                       TextWrapping="Wrap" />
            <TextBox Grid.Row="7"
                     VerticalAlignment="Center"
                     Text="{Binding Tag, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                     TextWrapping="Wrap" />
            <TextBlock Grid.Row="8"
                       Text="Category"
                       TextWrapping="Wrap" />
            <TextBox Grid.Row="9"
                     VerticalAlignment="Center"
                     core:ControlValidation.ErrorProperty="Category"
                     core:ControlValidation.ValidationSource="{Binding Validator}"
                     Validation.ErrorTemplate="{x:Static core:ControlValidation.ErrorTemplate}"
                     Text="{Binding Category, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                     MaxLength="255"
                     TextWrapping="Wrap" />
            <TextBlock Grid.Row="10"
                       Margin="0,0,0,8.8"
                       Text="Group name"
                       TextWrapping="Wrap" />
            <Grid Grid.Row="11"
                  Margin="6,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.50*" />
                    <ColumnDefinition Width="0.50*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="25.133" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBox Height="21.96"
                         Grid.Column="1"
                         Grid.Row="1"
                         VerticalAlignment="Center"
                         MaxLength="50"
                         IsEnabled="{Binding AddGroup}"
                         Text="{Binding NewGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         TextWrapping="Wrap" />
                <ComboBox Grid.Row="1"
                          Margin="0,0,10,0"
                          VerticalAlignment="Center"
                          DisplayMemberPath="Description"
                          IsEnabled="{Binding ChooseGroup}"
                          ItemsSource="{Binding Groups}"
                          SelectedItem="{Binding SelectedGroup}" />
                <RadioButton VerticalAlignment="Center"
                             Content="Pick a group"
                             GroupName="GroupOptions"
                             IsChecked="{Binding ChooseGroup}"
                             d:LayoutOverrides="Height" />
                <RadioButton Grid.Column="1"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Center"
                             Content="Create a new group"
                             GroupName="GroupOptions"
                             IsChecked="{Binding AddGroup}"
                             d:LayoutOverrides="Height" />
            </Grid>
            <TextBlock Grid.Row="12"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Text="Is visible to"
                       TextWrapping="Wrap"
                       d:LayoutOverrides="Height" />
            <Button Width="75"
                    Grid.Row="14"
                    HorizontalAlignment="Right"
                    Margin="0,5,5,0"
                    VerticalAlignment="Top"
                    Command="{Binding SaveSnippetCommand}"
                    Content="Save"
                    d:LayoutOverrides="Height" />
        </Grid>


    </Grid>


</ui:DialogWindow>